package cn.devices.mapper;


import cn.devices.entity.TbType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 设备类别表 Mapper 接口
 * </p>
 *
 * @author 秋水浮萍
 * @since 2021-02-07
 */
@Repository
public interface TbTypeMapper{

    @Insert("insert into tb_type(type_id, type_name, type_level) " +
            "VALUE (#{typeId},#{typeName},#{typeLevel})")
    int tbTypeAdd(TbType tbType);

    @Update("update tb_type set type_name=#{typeName},type_level=#{typeLevel} where type_id=#{typeId}")
    int tbTypeUpdate(TbType tbType);

    @Update("update tb_type set type_id=#{tbTypeIdNew} where type_id=#{typeIdOld}")
    int tbTypeID(String typeIdOld,String tbTypeIdNew);

    @Delete("delete from tb_type where type_id=#{typeId}")
    int tbTypeDelete(String typeId);

    @Select("select * from tb_type where type_id=#{typeId}")
    TbType tbType(String typeId);

    @Select("select * from tb_type order by type_id")
    List<TbType> tbTypeList();

    @Select("select * from tb_type where type_id=#{typeId}")
    TbType tbTypeSelect(String typeId);


}
